package com.zestinn.smart4j.framework.helper;


import com.zestinn.smart4j.framework.ConfigConstant;
import com.zestinn.smart4j.framework.util.PropsUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Properties;

/**
 * @author zestinn
 * @create 2017-09-21 15:11
 */
public class ConfigHelper {
    private static final Logger LOGGER = LoggerFactory.getLogger(ConfigHelper.class);

    private static final Properties CONFIG_PROPS = PropsUtil.loadProperties(ConfigConstant.CONFIG_FILE);

    /**
     * 获取JDBC的驱动
     * @return
     */
    public static String getJdbcDriver(){
        return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_DRIVER);
    }

    /**
     * 获取JDBC的URL
     * @return
     */
    public static String getJdbcUrl(){
        return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_URL);
    }

    /**
     * 获取JDBC的username
     * @return
     */
    public static String getJdbcUsername(){
        return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_USERNAME);
    }

    /**
     * 获取JDBC的password
     * @return
     */
    public static String getJdbcPassword(){
        return PropsUtil.getString(CONFIG_PROPS, ConfigConstant.JDBC_PASSWORD);
    }


    //获取jsp的路径
    public static String getAppJspPath(){
        return CONFIG_PROPS.getProperty(ConfigConstant.APP_JSP_PATH);
    }

    //获取静态资源的路径
    public static String getAppAssetPath() {
        return CONFIG_PROPS.getProperty(ConfigConstant.APP_ASSET_PATH);
    }

    //获取基础包路径
    public static String getAppBasePackagePath(){
        return CONFIG_PROPS.getProperty(ConfigConstant.APP_BASE_PACKAGE);
    }
}
